import React, {useEffect, useState} from 'react';
import {useParams} from "react-router-dom";
import axios from "axios";

function Details(props) {
    const {login} = useParams();
    const [info,setInfo] = useState({});
    useEffect(()=>{
        axios.get("https://api.github.com/users/"+login).then(value=>{
            console.log(value.data);
            setInfo(value.data);
        })
    },[])
    return (
        <div>
            <h3>{info.login}用户详情</h3>
            <img src={info.avatar_url} alt=""/>

        </div>
    );
}

export default Details;